package com.gy.hsim.bservice.netAuth.service.impl;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;

import com.gy.hsim.bservice.framework.bean.BaseRequest;
import com.gy.hsim.bservice.framework.mapper.NetAuthMapper;
import com.gy.hsim.bservice.netAuth.bean.NetAuth;
import com.gy.hsim.bservice.netAuth.service.NetAuthService;



/**
 * 
 * @ClassName: NetAuthServiceImpl 
 * @Description: 网元鉴权业务实现类 
 * @author Lee 
 * @date 2015-2-2 上午10:09:50
 */
@Scope("prototype")
@Service("netAuthService")
public class NetAuthServiceImpl implements NetAuthService{

	private static final Logger log = LoggerFactory
			.getLogger(NetAuthServiceImpl.class);

	/**
	 * 网元鉴权mapper接口
	 */
	@Autowired
	private NetAuthMapper netAuthMapper;
	
	@Override
	public boolean auth(BaseRequest baseRequest) {
		// TODO Auto-generated method stub
		
		boolean result =false;
		
		List<NetAuth> list = netAuthMapper.auth(baseRequest);
		
		if(list != null && list.size() > 0) {
			
			String passwd = list.get(0).getNetPassword();
			
			if(passwd != null && passwd.equals(baseRequest.getAccessPasswd())) {
				result =  true;
			}
		} 
		
		return result;
	}

	
}
